
module HornerHA where

horner :: Double -> [Double] -> Double
horner _ [] = 0
horner x (a:as) = a + x*(horner x as)

tailHorner :: Double -> [Double] -> Double -> Double -> Double
tailHorner _ [] s _ = s
tailHorner x (a:as) s factor = tailHorner (x) as (s+factor*a) (factor * x) 


test1 :: Double
test1 = horner 3 [1 .. 100000]

test2 :: Double
test2 = tailHorner 3 [1 .. 100000] 0 1